home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 December / macformat-057.iso / mac / Demos / Lineker's Real Football Demo / DATA / ScrlMenu / 00002_Script_2 < prev    next >
Encoding:
Text File  |  1997-08-03  |  2.0 KB  |  81 lines

  1. global Ydays, Febs, Mdays, Totyears, monthtext, datetext
  2. global baseday, theyear, themonth, theday, thedate
  3. global keydates, cdvar
  4.  
  5. on setupdummydates
  6.   set keydates = []
  7.   repeat with j = 1 to 2557
  8.     setat keydates,j,j 
  9.   end repeat
  10. end setupdummydates
  11.  
  12. on setupdatevars
  13.   set Totyears = 7
  14.   set baseday = 3 -- wednesday (1,1,92)
  15.   set Ydays = [366,365,365,365,366,365,365]
  16.   set Febs = [29,28,28,28,29,28,28]
  17.   set Mdays =[31,0,31,30,31,30,31,31,30,31,30,31]
  18.   set monthtext = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
  19.   set datetext = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
  20. end setupdatevars
  21.  
  22. on finddate offset
  23.   if offset<1 then return (" ")
  24.   set tmpnumber = offset
  25.   --ï find year ï
  26.   set yearoffset = 0
  27.   repeat with j = 1 to Totyears
  28.     set target = getat(Ydays,j)
  29.     if tmpnumber>target then
  30.       set yearoffset = yearoffset+1
  31.       set tmpnumber = tmpnumber-target
  32.     else
  33.       set theyear = 92+yearoffset
  34.       exit repeat
  35.     end if
  36.   end repeat
  37.   --ï find month ï
  38.   set monthoffset = 0
  39.   repeat with j = 1 to 12
  40.     set target = getat(Mdays,j)
  41.     if target = 0 then
  42.       set target = getat(Febs,yearoffset+1)
  43.     end if
  44.     if tmpnumber>target then
  45.       set monthoffset = monthoffset+1
  46.       set tmpnumber = tmpnumber-target
  47.     else
  48.       set themonth = 1+monthoffset
  49.       exit repeat
  50.     end if
  51.   end repeat
  52.   set thedate = tmpnumber
  53.   case thedate of
  54.     1,21,31: set tmpth = "st"
  55.     2,22: set tmpth = "nd"
  56.     3,23: set tmpth = "rd"
  57.     otherwise set tmpth = "th"
  58.   end case
  59.   set theday = ((offset+1) mod 7)+1
  60.   set tmpstring = getat(datetext,theday)&&string(thedate)&tmpth
  61.   set tmpstring = tmpstring&& getat(monthtext,themonth)&& string(theyear)
  62.   return tmpstring
  63. end finddate
  64.  
  65. on checkcontrol
  66.   if the controldown then
  67.     if cdvar = 0 then
  68.       set cdvar = 1
  69.       redisplaydates
  70.     end if
  71.   else
  72.     if cdvar = 1 then
  73.       set cdvar = 0
  74.       redisplaydates
  75.     end if
  76.   end if
  77. end checkcontrol
  78.  
  79.  
  80.  
  81.